﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RegExTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnProcess_Click(object sender, EventArgs e)
        {
            string Pattern = @txtRegEx.Text;

            //System.Text.RegularExpressions.MatchCollection match = System.Text.RegularExpressions.Regex.Matches(Content, "(?i)href=[\"'](.+?)[\"']");
            System.Text.RegularExpressions.Regex Regex = new System.Text.RegularExpressions.Regex(Pattern);
            System.Text.RegularExpressions.MatchCollection match = System.Text.RegularExpressions.Regex.Matches(txtInput.Text.Replace(Environment.NewLine,""), Pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
            foreach (System.Text.RegularExpressions.Match m in match)
                for (int i = 0; i < m.Groups.Count; i++)
                    txtOutput.Text += Regex.GetGroupNames()[i]+" : " + m.Groups[i].Value;
        
        }
    }
}
